package com.base.work.act;

import android.support.v7.widget.GridLayoutManager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.base.commonlib.base.CBaseBarMvpActivity;
import com.base.commonlib.recy.HFGridMultiTypeGapDecoration;
import com.base.commonlib.recy.HFMultiTypeRecyAdapter;
import com.base.commonlib.recy.animation.ScaleInAnimation;
import com.base.work.R;
import com.base.work.adapter.HFGridMuiltType;
import com.base.work.adapter.WorkData;
import com.base.work.databinding.ActivitySituationBinding;

/**
 * Created by weikailiang on 2020/3/4.
 */
@Route(path = "/work/situation")
public class SituationActivity extends CBaseBarMvpActivity{
    private ActivitySituationBinding mBinding;
    private HFMultiTypeRecyAdapter mAdapter;
    @Override
    protected int getLayoutResource() {
        return R.layout.activity_situation;
    }

    @Override
    protected void init() {
        super.init();
        mBinding = (ActivitySituationBinding) mRootBinding;
        setBackNavigation();
        setBarTitle("疫情");
    }

    @Override
    protected void start() {
        if (mAdapter == null) {
            mAdapter = new HFMultiTypeRecyAdapter();
            mAdapter.openLoadAnimation(new ScaleInAnimation());
            mBinding.recycler.setAdapter(mAdapter);
            GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 12);
            HFGridMuiltType spanSizeLookup = new HFGridMuiltType();
            spanSizeLookup.setAdapter(mAdapter);
            spanSizeLookup.setLayoutManager(gridLayoutManager);
            gridLayoutManager.setSpanSizeLookup(spanSizeLookup);
            mBinding.recycler.setLayoutManager(gridLayoutManager);
            HFGridMultiTypeGapDecoration gapDecoration = new HFGridMultiTypeGapDecoration(0);
            gapDecoration.setOffsetTopEnabled(false);
            mBinding.recycler.addItemDecoration(gapDecoration);
        }
        mAdapter.refreshDatas(WorkData.getWorkStationFragmentDatas());
    }
}
